package cn.sdstudio.service.impl;

import cn.sdstudio.model.PageResult;
import cn.sdstudio.model.Result;

import cn.sdstudio.entity.UserFavorite;
import cn.sdstudio.vo.FavoriteVO;

import cn.sdstudio.mapper.UserFavoriteMapper;
import cn.sdstudio.service.FavoriteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class FavoriteServiceImpl extends BaseServiceImpl<UserFavoriteMapper, UserFavorite> implements FavoriteService {

    @Autowired
    private  UserFavoriteMapper userFavoriteMapper;

    @Override
    public Result<PageResult<FavoriteVO>> listFavorites(Long userId, Integer page, Integer size) {
        return null;
    }

    @Override
    public Result deleteFavorites(Long userId, Long scenicId) {
        int row = userFavoriteMapper.deleteByUserId(userId, scenicId);
        if(row==1){
            Result.success(null);
        }

        return Result.error(400,"删除失败");
    }
}
